package com.liuhengjia.aiknowledgebase.scheduler;

import com.liuhengjia.aiknowledgebase.service.DocService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@EnableScheduling
@Component
@RequiredArgsConstructor
public class DocScanScheduler {
    private final DocService docService;

    /**
     * 每个一分钟加载/同步文档
     */
    @Scheduled(fixedRate = 1000 * 60)
    public void scan() {
        docService.loadData();
    }
}
